package com.bigdatastudio.admin.serviceImpl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bigdatastudio.admin.mapper.RoleMenuMapper;
import com.bigdatastudio.admin.service.IRoleMenuService;
import com.bigdatastudio.common.entity.RoleMenu;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RoleMenuServiceImpl extends ServiceImpl<RoleMenuMapper, RoleMenu> implements IRoleMenuService {

    @Autowired
    private IRoleMenuService iRoleMenuService;

    @Override
    public List<RoleMenu> getMenuByRoleId(int rid) {
        QueryWrapper<RoleMenu> wrapper = new QueryWrapper<>();
        wrapper.eq("role_id", rid);
        return iRoleMenuService.list(wrapper);
    }

    @Override
    public List<RoleMenu> getMenuByRoleId(List<Integer> rids) {
        QueryWrapper<RoleMenu> wrapper = new QueryWrapper<>();
        wrapper.in("role_id", rids);
        return iRoleMenuService.list(wrapper);
    }
}
